<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../print.css" type="text/css" media="print">
<meta content="NumberUtil,sandy.util.NumberUtil,TOL,HALF_PI,PI,TO_DEGREE,TO_RADIAN,TWO_PI,areEqual,constrain,isZero,roundTo,toDegree,toRadian" name="keywords">
<title>sandy.util.NumberUtil</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'NumberUtil - Sandy 3.1.2 API Documentation';
				var baseRef = '../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">Sandy 3D Engine, 3.1.2</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../all-classes.html')" href="../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../all-classes.html')" href="../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../index-list.html')" href="../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../index.html?sandy/util/NumberUtil.html&amp;sandy/util/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;NumberUtil</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class NumberUtil"); titleBar_setSubNav(false,true,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">sandy.util</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class NumberUtil</td>
</tr>
</table>
<p></p>
  Utility class for useful numeric constants and number manipulation.
   
  <p></p>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#HALF_PI">HALF_PI</a> : Number<div class="summaryTableDescription">[static][read-only]
   Math constant pi/2.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#PI">PI</a> : Number<div class="summaryTableDescription">[static][read-only]
   Math constant pi.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#TO_DEGREE">TO_DEGREE</a> : Number<div class="summaryTableDescription">[static][read-only]
   Constant used to convert angle from radians to degrees.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#TOL">TOL</a> : Number = 0.00001<div class="summaryTableDescription">[static]
   Value used to compare numbers with.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#TO_RADIAN">TO_RADIAN</a> : Number<div class="summaryTableDescription">[static][read-only]
   Constant used to convert degrees to radians.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#TWO_PI">TWO_PI</a> : Number<div class="summaryTableDescription">[static][read-only]
   Math constant pi&#42;2.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#areEqual()">areEqual</a>(p_nN:Number, p_nM:Number):Boolean</div>
<div class="summaryTableDescription">[static]
   Compares two numbers and determines if they are equal.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#constrain()">constrain</a>(p_nN:Number, p_nMin:Number, p_nMax:Number):Number</div>
<div class="summaryTableDescription">[static]
   Constrains a number to a given interval.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#isZero()">isZero</a>(p_nN:Number):Boolean</div>
<div class="summaryTableDescription">[static]
   Determines if a number is regarded as zero.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#roundTo()">roundTo</a>(p_nN:Number, p_nRoundToInterval:Number = 0):Number</div>
<div class="summaryTableDescription">[static]
   Rounds a number to specified accuracy.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#toDegree()">toDegree</a>(p_nRad:Number):Number</div>
<div class="summaryTableDescription">[static]
   Converts an angle from radians to degrees
      </div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#toRadian()">toRadian</a>(p_nDeg:Number):Number</div>
<div class="summaryTableDescription">[static]
   Converts an angle from degrees to radians.</div>
</td><td class="summaryTableOwnerCol">NumberUtil</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="HALF_PI"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">HALF_PI</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>HALF_PI:Number</code>&nbsp;&nbsp;[read-only]<p>
   Math constant pi/2.
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public static function get HALF_PI():Number</code>
<br>
</div>
<a name="PI"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">PI</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>PI:Number</code>&nbsp;&nbsp;[read-only]<p>
   Math constant pi.
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public static function get PI():Number</code>
<br>
</div>
<a name="TO_DEGREE"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">TO_DEGREE</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>TO_DEGREE:Number</code>&nbsp;&nbsp;[read-only]<p>
   Constant used to convert angle from radians to degrees.
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public static function get TO_DEGREE():Number</code>
<br>
</div>
<a name="TOL"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">TOL</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static var TOL:Number = 0.00001</code><p>
   Value used to compare numbers with. 
   
   </p><p>Basically used to say if a number is zero or not.<br />
   Adjust this number with regard to the precision of your application</p>
   </div>
<a name="TO_RADIAN"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">TO_RADIAN</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>TO_RADIAN:Number</code>&nbsp;&nbsp;[read-only]<p>
   Constant used to convert degrees to radians.
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public static function get TO_RADIAN():Number</code>
<br>
</div>
<a name="TWO_PI"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">TWO_PI</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>TWO_PI:Number</code>&nbsp;&nbsp;[read-only]<p>
   Math constant pi&#42;2.
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public static function get TWO_PI():Number</code>
<br>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="areEqual()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">areEqual</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public static function areEqual(p_nN:Number, p_nM:Number):Boolean</code><p>
   Compares two numbers and determines if they are equal.
   
   </p><p>Adjust the TOL property depending on the precision of your application.</p>
      <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_nN</span>:Number</code> &mdash;  The first number.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_nM</span>:Number</code> &mdash;  The second number.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code> &mdash;  Whether the numbers are regarded as equal.
   </td>
</tr>
</table>
</div>
<a name="constrain()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">constrain</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function constrain(p_nN:Number, p_nMin:Number, p_nMax:Number):Number</code><p>
   Constrains a number to a given interval.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_nN</span>:Number</code> &mdash;   The number to constrain.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_nMin</span>:Number</code> &mdash;  The minimal valid value.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_nMax</span>:Number</code> &mdash;  The maximal valid value.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Number</code> &mdash;   The constrained number.
   </td>
</tr>
</table>
</div>
<a name="isZero()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">isZero</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function isZero(p_nN:Number):Boolean</code><p>
   Determines if a number is regarded as zero.
      </p><p>Adjust the TOL property depending on the precision of your application.</p>
      <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_nN</span>:Number</code> &mdash;  The number to compare to zero.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code> &mdash;  Whether the number is to be regarded as zero.
   </td>
</tr>
</table>
</div>
<a name="roundTo()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">roundTo</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function roundTo(p_nN:Number, p_nRoundToInterval:Number = 0):Number</code><p>
   Rounds a number to specified accuracy.
      </p><p>To round off the number to 2 decimals, set the the accuracy to 0.01</p>
      <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_nN</span>:Number</code> &mdash;     The number to round.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_nRoundToInterval</span>:Number</code> (default = <code>0</code>)<code></code> &mdash; The accuracy to which to round.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Number</code> &mdash;    The rounded number.
   </td>
</tr>
</table>
</div>
<a name="toDegree()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">toDegree</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function toDegree(p_nRad:Number):Number</code><p>
   Converts an angle from radians to degrees
      </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_nRad</span>:Number</code> &mdash; A number representing the angle in radians.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Number</code> &mdash;   The angle in degrees.
   </td>
</tr>
</table>
</div>
<a name="toRadian()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">toRadian</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function toRadian(p_nDeg:Number):Number</code><p>
   Converts an angle from degrees to radians.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_nDeg</span>:Number</code> &mdash;  A number representing the angle in dregrees.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Number</code> &mdash;   The angle in radians.
   </td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright">API documentation for Sandy 3D Engine, Ver. 3.1.2</center>
</div>
</body>
</html>
<!--API documentation for Sandy 3D Engine, Ver. 3.1.2-->
